﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace EnhancedWebControls
{
    /// <summary>
    /// Represents a single navigation destination
    /// </summary>
    [Serializable()]
    public class NavBarMenuItem
    {
        /// <summary>
        /// Gets or Sets the Unique Id for this Menu Item
        /// </summary>
        public int MenuID {get;set;}
        /// <summary>
        /// Gets or Sets the Parent Id for this menu item effectively linking it as a child item to a different menu item
        /// </summary>
        public int ParentID {get;set;}
        /// <summary>
        /// Gets or Sets the Display Text for this menu item
        /// </summary>
        public string MenuText { get; set; }
        /// <summary>
        /// Gets or Sets the description text for this menu item, also used as the tooltip text when rendered
        /// </summary>
        public string MenuDescription { get; set; }
        /// <summary>
        /// Gets or Sets the Navigation Destination for this item can be relative or fully qualified
        /// </summary>
        public string NavigateUrl { get; set; }
        /// <summary>
        /// Gets or Sets whether this item is visible or hidden in the menu
        /// </summary>
        public bool HideInMenu { get; set; }
        /// <summary>
        /// Gets or Sets whether this item is opened in a new window. If this is true this item is rendered as a link regardless of the Nav Bar Settings
        /// </summary>
        public bool OpenInNewWindow { get; set; }
        /// <summary>
        /// Gets whether this item is a parent item or not
        /// </summary>
        public bool IsParent
        {
            get
            {
                return ParentID <= 0;
            }
        }
        /// <summary>
        /// Gets the generated Unique control ID based on the MenuID and ParentID of the item
        /// </summary>
        protected internal string MenuTextID
        {
            get
            {
                return "menuItem_" + ParentID + "_" + MenuID;
            }
        }
    }
}
